package com.hand.todo.api.controller.v1;

<<<<<<< HEAD
import com.hand.todo.domain.entity.HodrSoHeader;
import com.hand.todo.domain.entity.HodrSoLine;
//import com.hand.todo.domain.repository.SoLineRepository;
import com.hand.todo.infra.mapper.SoHeaderMapper;
import com.hand.todo.infra.mapper.SoLineMapper;
import io.choerodon.mybatis.pagehelper.domain.PageRequest;
=======
import com.hand.todo.domain.entity.HodrSoLine;
import com.hand.todo.domain.mapper.HodrSoLineMapper;
import com.hand.todo.domain.repository.SomeRopo;
>>>>>>> 08166dcae0fc4e7661331ad59cced26a4fc34bcf
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;

import org.hzero.core.base.BaseController;
import org.hzero.core.util.Results;
import com.hand.todo.app.service.ExampleService;
import com.hand.todo.config.SwaggerTags;
import com.hand.todo.domain.entity.Example;
import com.hand.todo.domain.repository.ExampleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import io.choerodon.core.iam.ResourceLevel;
import io.choerodon.swagger.annotation.Permission;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.List;

/**
 * API接口
 */
@Api(tags = SwaggerTags.EXAMPLE)
@RestController("exampleController.v1")
@RequestMapping("/v1/example")
public class ExampleController extends BaseController {

    @Autowired
    private SoHeaderMapper mapper;
    @Autowired
    private ExampleService exampleService;
    @Autowired
    private ExampleRepository exampleRepository;
//    @Autowired
//    private SomeRopo some;

    @ApiOperation(value = "根据ID获取")
    @Permission(level = ResourceLevel.ORGANIZATION)
    @GetMapping("/{id}")
    public ResponseEntity<Long> hello(@PathVariable Long id) {
        return Results.success(id);
    }

//    @GetMapping("/hello")
//    public ResponseEntity<Example> hello(){
//        Example emp = new Example();
//        emp.setCode("demo");
//        emp.setId(1L);
//        emp.setName("测试");
//        return Results.success(emp);
//    }

    @GetMapping("/hello2/test")
    public String hello2() {
        return "hello world";
    }

<<<<<<< HEAD
    @GetMapping("/hello")
    public String hello() {
        return "hello world";
    }

    @Permission(level = ResourceLevel.SITE)
    @GetMapping("/hello3/test/{id}")
    public String hello3(@PathVariable("id") int id) {
        return "hello " + id;
    }


    @Permission(level = ResourceLevel.SITE)
    @ApiOperation("订单查询总api")
    @GetMapping("/{organizationId}/test")
    public String list(
            @PathVariable("organizationId") int organizationId,
            PageRequest pageRequest
    ) {
        return "list" + organizationId;
    }

    @ApiOperation("订单汇总删除")
    @GetMapping("/so-headers/batch")
    public void remove(@RequestParam(value = "companyId", required = false) long comId,
                       @RequestParam(value = "customerId", required = false) long cusId,
                       @RequestParam(value = "orderNumber", required = false) String orderNumber,
                       @RequestParam(value = "orderStatus", required = false) String status,
                       @RequestParam(value = "item", required = false) String item
    ) {
        HodrSoHeader header = new HodrSoHeader();
        header.setCompanyId(comId);
        header.setCustomerId(cusId);
        header.setOrderStatus(status);
        mapper.delete(header);
    }

//    @GetMapping("/${soheader()}/so-headers/batch")
//    public void remove2(@PathVariable("soheader") HodrSoHeader soHeader) {
////        mapper.delete(soHeader);
//        System.out.println(soHeader.toString());
//    }

//    @PostMapping("${getCurrentOrganizationId()}/so-headers/save")
//    public List<HodrSoHeader> save(@PathVariable("soheader") HodrSoHeader soHeader) {
//        mapper.insert(soHeader);
//        return null;
//    }

    @ApiOperation("新增订单头信息")
    @PostMapping("/{organizationId}/so-headers/save")
    public ResponseEntity<HodrSoHeader> save(
            @PathVariable("organizationId") long orgId,
            @RequestBody HodrSoHeader soHeader
    ) {
        return null;
    }

    @ApiOperation("更改订单头信息")
    @PostMapping("/{organizationId}/so-headers/update")
    public ResponseEntity<HodrSoHeader> update(
            @PathVariable("organizationId") long orgId,
            @RequestBody HodrSoHeader soHeader
    ) {
        return null;
    }

    @ApiOperation("订单提交")
    @PostMapping("/{organizationId}/so-headers/submit")
    public void submit(
            @PathVariable("organizationId") long orgId,
            @RequestBody HodrSoHeader soHeader
    ) {
    }

//    @GetMapping("/list")
//    public ResponseEntity<List<HodrSoLine>> list() {
//        return Results.success(lineMapper.selectAll());
//    }

=======
//    @ApiOperation("hello")
//    @Permission(level = ResourceLevel.SITE, permissionLogin = true)
//    @GetMapping("/hello")
//    public ResponseEntity<Example> hello(){
//        Example emp = new Example();
//        emp.setCode("demo");
//        emp.setId(1L);
//        emp.setName("测试");
//        return Results.success(emp);
//    }
>>>>>>> 08166dcae0fc4e7661331ad59cced26a4fc34bcf
}